//
//  SMSRequestProvider.m
//  SulitLoan
//
//  Created by 虞嘉伟 on 2025/2/26.
//  
  

#import "HomeRequestProvider.h"
#import "HomeRequest.h"
//#import <YYKit/YYKit.h>

@implementation HomeModel
@end
@implementation CommonlyModel
@end
@implementation FurnishesModel
@end
@implementation WantedModel
@end

@implementation HomeRequestProvider

+ (void)requestHomeWithSuccess:(void(^)(HomeModel *model))success failure:(void(^)(YTKRequest *request))failure {
//    HomeRequest *request = [HomeRequest new];
//    [request startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
//        NSDictionary *dict = request.responseObject;
//        if (![dict isKindOfClass:NSDictionary.class]) {
//            !failure ?: failure(request);
//            return;
//        }
//        if ([dict[@"weeps"] intValue] == 0) {
//            // 成功
//            HomeModel *model = [HomeModel modelWithJSON:dict[@"bounding"]];
//            !success ?: success(model);
//        } else {
//            !failure ?: failure(request);
//        }
//    } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
//        !failure ?: failure(request);
//    }];
}


+ (void)requestNewHomeWithSuccess:(void(^)(NSDictionary *dict))success failure:(void(^)(YTKRequest *request))failure {
    HomeRequest *request = [HomeRequest new];
    [request startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
        NSDictionary *dict = request.responseObject;
        if (![dict isKindOfClass:NSDictionary.class]) {
            !failure ?: failure(request);
            return;
        }
        if ([dict[@"weeps"] intValue] == 0) {
            // 成功
            !success ?: success(dict[@"bounding"]);
        } else {
            !failure ?: failure(request);
        }
    } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        !failure ?: failure(request);
    }];
}


@end
